<%@ page language="java" contentType="text/html;charset=UTF-8"%>
<%@ taglib  uri="http://java.sun.com/jsp/jstl/functions" prefix= "fn"%>
<%@ include file="/commons/taglibs.jsp"%>
<%@ include file="/commons/messages.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>新增业主资料</title>
<script type="text/javascript" src="${ctx}/scripts/common/prototype.js"></script>
<script type="text/javascript" src="${ctx}/scripts/public.js"></script>
<script type="text/javascript" src="${ctx}/scripts/div/window.js"></script>
<link href="${ctx}/styles/grid.css" rel="stylesheet" type="text/css">
<link href="${ctx}/styles/listTable.css" rel="stylesheet" type="text/css">
<link href="${ctx}/styles/show.css" rel="stylesheet" type="text/css" />
<link href="${ctx}/styles/public.css" rel="stylesheet" type="text/css">
<link href="${ctx}/styles/aux_window.css" rel="stylesheet" type="text/css">

<script language="JavaScript" type="text/javascript" src="${ctx}/scripts/tags/tabs/tabs.js"></script>
<link href="${ctx}/styles/tags/tabs.css" rel="stylesheet" type="text/css">

<script language="JavaScript" type="text/javascript" src="${ctx}/scripts/div/common.js"></script>
<script language="JavaScript" type="text/javascript" src="${ctx}/scripts/common.js"></script>
<script language="JavaScript"  src="${ctx}/scripts/ajaxException.js"></script>
<script type="text/javascript">
	function openSave(){
		var url = "${ctx}/customer_ownerAction.do?method=addCustomer";
		sendAjaxRequest(url,null,flushIframe);
	}

	function flushIframe(response){
		var responseText = response.responseText;//获取返回的字符串
		ajaxSubmitException(response.responseText);
		if(responseText == "houseListIsNumm"){
			Alert("请添加房屋");
			return false;
		}
		if(responseText == "customerIsNumm"){
			Alert("请添加业主信息");
			return false;
		}
		flushCustomerMian();
		setFamilyEdit();//设置家庭成员tab可用
	}
	/*****家庭成员*****/
	function setFamilyEdit(){
	 	ableTabEdit("tabFamily");
	}

	function setFamilyUnEdit(){
		disableTabEdit("tabFamily");
	}
	/*****设置保存按钮状态*****/
	function setButtonStatus(status){
		$('btn1_52').disabled = !status;
		$('btn1_32').disabled = !status;
	}
	function setsubmitBtnUnEdit(){
		$('btn1_52').disabled = true;
	}
	function setsubmitBtnEdit(){
	    $('btn1_52').disabled=false;
	}
	//关闭窗体方法
	//在关闭前  需要检查数据是否改变了。如果有改变需要提示是否保存，否则直接关闭。
	function beforChoseWindow(flag){
		if(flag) {windowClose();return;}
		var url = "${ctx}/customer_customerAction.do?method=closeCheckCache&customerTypeCode=001";
		sendAjaxRequest(url,null,function(_response){
				var responseText = _response.responseText;
				if(responseText == "no"){
					AskConfirmTwo("数据已经发生改变，是否保存",'addOwnerFrame','openSave','windowClose');
				}else{
					windowClose();
				}
		});
	}

	var type = '${type}';
	function flushCustomerMian(){
		//判断是否是由退伙模块引用的
		if (type != null && type!="" && type == "goOut" ){
				var mainFrm = findFrame("proRightModIfm");
				mainFrm.refreshList();
				return ;
		}

		var objMainFrm = findFrame("main");
		objMainFrm.reloadFrame();//刷新列表
	}
</script>
</head>

<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	  <tr>
	    <td class="window_head_outBg">
		    <table border="0" cellpadding="0" cellspacing="0">
		      <tr>
		        <td><img src="${ctx}/images/ico_Advance.gif" width="16" height="16" align="absmiddle">
		        	<span class="window_head_intext">新增业主资料</span></td>
		      </tr>
		    </table>
	    </td>
	  </tr>
	  <tr>
	    <td class="aux_header_line_1"></td>
	  </tr>
	  <tr>
	    <td class="aux_header_line_2"></td>
	  </tr>
	  <tr>
		    <td valign="middle" class="content">
			    <table width="100%" border="0" cellpadding="0" cellspacing="0" class="container_in_show">
			      <tr>
			        <td valign="top">
				        <pms:tabPanel panelId="owner" hasTop="false" iframeId="ownerList" defaultHeight="400px">
							<pms:tab tabId="ownerBase"
									 baseUrl="${ctx}/customer_ownerAction.do?method=initOwnerBaseMain&houseId=${houseId}&type=${type}"
									 caption="基本资料"
									 defaultTab="true"
									 beforeFunction="setsubmitBtnEdit();">
							</pms:tab>

							<pms:tab tabId="tabFamily"
									 baseUrl="${ctx}/customer_memberAction.do?method=showMemberInfoList&keyId=ownerHouseColletion"
									 caption="家庭成员资料"
                                     canEdit="false"
									 beforeFunction="setsubmitBtnUnEdit();"
									 >
							</pms:tab>
				        </pms:tabPanel>
					</td>
			      </tr>
			     </table>
		     </td>
         	<td class="btn_between_space"></td>
      </tr>
  <tr>
    <td class="window_footer"><table border="0" align="right" cellpadding="0" cellspacing="0">
        <tr>
		  <td class="btn_between_space"></td>
          <td><table border="0" cellpadding="0" cellspacing="0" >
            <tr>
              <td class="buttonOffLeft" id="btn1_51"></td>
              <td class="buttonOffMiddle" id="btn1_52" onblur="btn_change(5)" onMouseOver="btn_change_over(5)" onMouseOut="btn_change_out(5)" onClick="openSave();"><img  id="img_btn1_52"  src="${ctx}/images/ico_ok.gif" border="0" align="absmiddle" /> 保 存</td>
              <td class="buttonOffRight" id="btn1_53"></td>
            </tr>
        </table></td>
        <td class="btn_between_space"></td>
        <td><table border="0" cellpadding="0" cellspacing="0" onclick="beforChoseWindow(false);">
            <tr>
              <td class="buttonOffLeft" id="btn1_31"></td>
              <td class="buttonOffMiddle" id="btn1_32" onblur="btn_change(3)" onMouseOver="btn_change_over(3)" onMouseOut="btn_change_out(3)"><img src="${ctx}/images/ico_cancel.gif" border="0" align="absmiddle" /> 关 闭</td>
              <td class="buttonOffRight" id="btn1_33"></td>
            </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
</table>


</body>
</html>